import Vue from 'vue'
import VueRouter from 'vue-router'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
    return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const router = new VueRouter({
    routes: [{
        path: '/',
        redirect: '/poetry'
    }, {
        path: '/poetry',
        component: () =>
            import ('../views/right.vue')
    }, {
        path: '/aa',
        component: () =>
            import ('../views/aa.vue')
    }, {
        path: '/bb',
        component: () =>
            import ('../views/bb.vue')
    }],
    linkActiveClass: 'active',
    mode: 'history'
})
router.beforeEach((to, from, next) => {
    window.document.title = to.meta.title;
    next();
})

export default router